<?php	if ($related_products->num_rows() > 0){ ?>
<div id="realted-products" class="rounded">
	<div class="related-product-left">
		<h3>Related products</h3>
	</div>

	<div class="related-product-right">
		<?php foreach($related_products->result() as $row){ ?>
				<div class="related-items">
					<a href="<?php echo $this->config->item('base_url'),'/track?url=', urlencode(str_replace('http://', '', $product->aff_url)); ?>" target="_blank">
						<?php if(empty($row->aff_img_medium)){ ?>
							<img class="boximg" src="<?php echo $this->config->config['public_url'].'/images/img-default.png'; ?>" alt="No image exists" width="70" height="90" />
						<?php } else{ ?>
							<img class="boximg" src="<?php echo $row->aff_img_medium; ?>" alt="<?php $row->product_title; ?>"  width="70" height="90"/>
						<?php } ?>
					</a>
				</div>
		<?php }	?>
		<!--<div class="related-items"><a href=" http://jinsonathemes.com/fabs/?goods=sony-ericsson-xperia-play "  title="Sony Ericsson Xperia Play" ><img class="boximg" src="http://jinsonathemes.com/fabs/wp-content/themes/Ebuy/timthumb.php?src=http://jinsonathemes.com/fabs/wp-content/uploads/2011/11/51Je2z.jpg&amp;w=100&amp;h=100&amp;zc=1" alt=""/></a></div>
		<div class="related-items"><a href=" http://jinsonathemes.com/fabs/?goods=samsung-galaxy-s-ii "  title="Samsung Galaxy S II" ><img class="boximg" src="http://jinsonathemes.com/fabs/wp-content/themes/Ebuy/timthumb.php?src=http://jinsonathemes.com/fabs/wp-content/uploads/2011/11/41Np4skSQHL._SS500_.jpg&amp;w=100&amp;h=100&amp;zc=1" alt=""/></a></div>
		<div class="related-items"><a href=" http://jinsonathemes.com/fabs/?goods=apple-iphone-4g "  title="Apple iPhone 4G" ><img class="boximg" src="http://jinsonathemes.com/fabs/wp-content/themes/Ebuy/timthumb.php?src=http://jinsonathemes.com/fabs/wp-content/uploads/2011/11/41Pthp4ZJFL._SS500_.jpg&amp;w=100&amp;h=100&amp;zc=1" alt=""/></a></div>-->
	</div>
	<div class="cb"></div>
</div>
<?php } ?>
<script>
	//Script to generate title of product in tooltip.
	jQuery(document).ready(function(){
		//initiate tooltip script
		jQuery('#realted-products .related-product-right a[title]').tooltip({effect: 'fade'});
				
		//create fade effect on tooltip
		jQuery('#realted-products .related-product-right a').hover(function(){
		jQuery('#tooltip').css('opacity',0);
			jQuery('#tooltip').animate({'opacity':1});
		},function(){
			jQuery('#tooltip').css('opacity',0);
		});
	});
</script>